package com.njts.process;

/**
 * @author David GE
 * Date  2025/11/11
 */
public class Bit {
    public static void main(String[] args) {
        int a = 6;// 000110 1111111001
        int b = - 18; // 18=2^4+2^1  110110
        System.out.println(a & b); //6   110
        System.out.println(a | b); //-18
        System.out.println(a ^ b); //-24 110000
        System.out.println(~ a); //-7
        System.out.println(a << 2); //24 2^2
        System.out.println(a >> 2); //1 0001 /2^2
        System.out.println(b >> 2); //-5 1101
        System.out.println(a >>> 2); //1
        System.out.println(b >>> 2); //1073741819// 10000000001101


        // 给定两个数,输出其中较大值
        int c =3;
        int d =5;
        int e =c>d?c:d;// ? :

    }
}